package com.dxg.msns.common.pojo;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;

/**
 * 音乐收藏实体类
 * 对应数据库表：music_favor
 * 
 * @author system
 */
@Table(name = "music_favor")
public class MusicFavor implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 音乐ID
     */
    @Column(name = "music_id")
    private Integer musicId;

    /**
     * 收藏者ID
     */
    @Column(name = "collector_id")
    private String collectorId;

    /**
     * 收藏时间
     */
    @Column(name = "favor_date")
    private Date favorDate;

    /**
     * 收藏状态
     */
    @Column(name = "favor_status")
    private Integer favorStatus;

    // 构造方法
    public MusicFavor() {
    }

    public MusicFavor(Integer musicId, String collectorId) {
        this.musicId = musicId;
        this.collectorId = collectorId;
        this.favorDate = new Date();
        this.favorStatus = 1;
    }

    // Getter 和 Setter 方法
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getMusicId() {
        return musicId;
    }

    public void setMusicId(Integer musicId) {
        this.musicId = musicId;
    }

    public String getCollectorId() {
        return collectorId;
    }

    public void setCollectorId(String collectorId) {
        this.collectorId = collectorId;
    }

    public Date getFavorDate() {
        return favorDate;
    }

    public void setFavorDate(Date favorDate) {
        this.favorDate = favorDate;
    }

    public Integer getFavorStatus() {
        return favorStatus;
    }

    public void setFavorStatus(Integer favorStatus) {
        this.favorStatus = favorStatus;
    }

    @Override
    public String toString() {
        return "MusicFavor{" +
                "id=" + id +
                ", musicId=" + musicId +
                ", collectorId='" + collectorId + '\'' +
                ", favorDate=" + favorDate +
                ", favorStatus=" + favorStatus +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;

        MusicFavor that = (MusicFavor) o;

        if (!musicId.equals(that.musicId))
            return false;
        return collectorId.equals(that.collectorId);
    }

    @Override
    public int hashCode() {
        int result = musicId.hashCode();
        result = 31 * result + collectorId.hashCode();
        return result;
    }
}